package com.aspose.cells;

import java.util.ArrayList;

class zcbx {
   zcby[] a;
   zcbz[] b;
   byte[][] c;
   String d;

   zcbx() {
   }

   zcbx(FormatConditionCollection var1) {
      this.b = new zcbz[1];
      zcbz var2 = new zcbz();
      this.b[0] = var2;
      var2.a = 2;
      var2.b = new CellArea[var1.b.size()];

      for(int var3 = 0; var3 < var1.b.size(); ++var3) {
         var2.b[var3] = (CellArea)var1.b.get(var3);
      }

   }

   zcbx(FormatCondition var1) {
      int var2 = 0;
      if (var1.a() != null) {
         ++var2;
      }

      if (var1.c() != null) {
         ++var2;
      }

      if (var2 != 0) {
         this.c = new byte[var2][];
         var2 = 0;
         if (var1.a() != null) {
            this.c[var2++] = var1.a();
         }

         if (var1.c() != null) {
            this.c[var2++] = var1.c();
         }

         for(int var3 = 0; var3 < this.c.length; ++var3) {
            byte[] var4 = this.c[var3];
            byte[] var5 = new byte[var4.length];
            int var6 = com.aspose.cells.b.a.zc.a(var4, 0);
            int var7 = com.aspose.cells.b.a.zc.a(var4, var6 + 4);
            System.arraycopy(var4, 0, var5, 0, 4);
            System.arraycopy(var4, var6 + 4, var5, 4, 4);
            System.arraycopy(var4, 4, var5, 8, var6);
            System.arraycopy(var4, var6 + 8, var5, var6 + 8, var7);
            this.c[var3] = var5;
         }
      }

   }

   zcbx(ConditionalFormattingValue var1) {
      if (var1.e() && var1.f() != null) {
         this.c = new byte[1][];
         byte[] var2 = var1.f();
         byte[] var3 = new byte[var2.length];
         int var4 = com.aspose.cells.b.a.zc.a(var2, 0);
         int var5 = com.aspose.cells.b.a.zc.a(var2, var4 + 4);
         System.arraycopy(var2, 0, var3, 0, 4);
         System.arraycopy(var2, var4 + 4, var3, 4, 4);
         System.arraycopy(var2, 4, var3, 8, var4);
         System.arraycopy(var2, var4 + 8, var3, var4 + 8, var5);
         this.c[0] = var3;
      }

   }

   ArrayList a() {
      if (this.b == null) {
         return null;
      } else {
         ArrayList var1 = new ArrayList();

         for(int var2 = 0; var2 < this.b.length; ++var2) {
            zcbz var3 = this.b[var2];
            if (var3.b != null) {
               for(int var4 = 0; var4 < var3.b.length; ++var4) {
                  com.aspose.cells.b.a.a.ze.a(var1, (Object)var3.b[var4]);
               }
            }
         }

         return var1;
      }
   }

   byte b() {
      byte var1 = 0;
      if (this.a != null) {
         var1 = (byte)(var1 | 1);
      }

      if (this.b != null) {
         var1 = (byte)(var1 | 2);
      }

      if (this.c != null) {
         var1 = (byte)(var1 | 4);
      }

      if (this.d != null) {
         var1 = (byte)(var1 | 8);
      }

      return var1;
   }

   int a(byte[] var1, int var2) throws Exception {
      byte var4 = var1[var2];
      int var3 = var2 + 4;
      int var5;
      int var6;
      if ((var4 & 255 & 1) != 0) {
         var5 = com.aspose.cells.b.a.zc.a(var1, var3);
         var3 += 4;
         this.a = new zcby[var5];

         for(var6 = 0; var6 < var5; ++var6) {
            zcby var7 = new zcby();
            var7.a = com.aspose.cells.b.a.zc.a(var1, var3);
            var3 += 4;
            var7.b = zcch.a(var1, var3);
            var3 += 16;
            this.a[var6] = var7;
            --var5;
         }
      }

      int var8;
      if ((var4 & 255 & 2) != 0) {
         var5 = com.aspose.cells.b.a.zc.a(var1, var3);
         this.b = new zcbz[var5];
         var3 += 4;

         for(var6 = 0; var6 < var5; ++var6) {
            zcbz var11 = new zcbz();
            this.b[var6] = var11;
            var11.a = com.aspose.cells.b.a.zc.a(var1, var3);
            var3 += 4;
            var8 = com.aspose.cells.b.a.zc.a(var1, var3);
            var3 += 4;
            if (var8 > 0) {
               var11.b = new CellArea[var8];

               for(int var9 = 0; var9 < var8; ++var9) {
                  CellArea var10 = new CellArea();
                  var10.StartRow = com.aspose.cells.b.a.zc.a(var1, var3);
                  var10.EndRow = com.aspose.cells.b.a.zc.a(var1, var3 + 4);
                  var10.StartColumn = com.aspose.cells.b.a.zc.a(var1, var3 + 8);
                  var10.EndColumn = com.aspose.cells.b.a.zc.a(var1, var3 + 12);
                  var11.b[var9] = var10;
                  var3 += 16;
               }
            }
         }
      }

      if ((var4 & 255 & 4) != 0) {
         var5 = com.aspose.cells.b.a.zc.a(var1, var3);
         this.c = new byte[var5][];
         var3 += 4;

         for(var6 = 0; var6 < var5; ++var6) {
            var3 += 4;
            int var12 = com.aspose.cells.b.a.zc.a(var1, var3);
            var8 = com.aspose.cells.b.a.zc.a(var1, var3 + 4);
            var3 += 8;
            byte[] var13 = new byte[var12 + var8 + 8];
            this.c[var6] = var13;
            byte var14 = 0;
            System.arraycopy(com.aspose.cells.b.a.zc.a(var12), 0, var13, var14, 4);
            int var15 = var14 + 4;
            System.arraycopy(var1, var3, var13, var15, var12);
            var3 += var12;
            var15 += var12;
            if (var8 != 0) {
               System.arraycopy(com.aspose.cells.b.a.zc.a(var8), 0, var13, var15, 4);
               var15 += 4;
               System.arraycopy(var1, var3, var13, var15, var8);
               var3 += var8;
               int var10000 = var15 + var8;
            }
         }
      }

      if ((var4 & 255 & 8) != 0) {
         this.d = zcch.d(var1, var3);
         var3 += this.d.length() * 2 + 2;
      }

      return var3;
   }

   int c() {
      int var1 = 4;
      if (this.a != null) {
         var1 += 4 + this.a.length * 20;
      }

      int var2;
      if (this.b != null) {
         var1 += 4;

         for(var2 = 0; var2 < this.b.length; ++var2) {
            var1 += 8 + this.b[var2].b.length * 16;
         }
      }

      if (this.c != null) {
         var1 += 4;

         for(var2 = 0; var2 < this.c.length; ++var2) {
            var1 += this.c[var2].length + 4;
         }
      }

      if (this.d != null) {
         var1 += this.d.length() * 2 + 2;
      }

      return var1;
   }

   int b(byte[] var1, int var2) throws Exception {
      var1[var2] = this.b();
      int var3 = var2 + 4;
      int var4;
      if (this.a != null) {
         System.arraycopy(com.aspose.cells.b.a.zc.a(this.a.length), 0, var1, var3, 4);
         var3 += 4;

         for(var4 = 0; var4 < this.a.length; ++var4) {
            zcby var5 = this.a[var4];
            System.arraycopy(com.aspose.cells.b.a.zc.a(var5.a), 0, var1, var3, 4);
            var3 += 4;
            zcch.a(var5.b, var1, var3);
            var3 += 16;
         }
      }

      if (this.b != null) {
         System.arraycopy(com.aspose.cells.b.a.zc.a(this.b.length), 0, var1, var3, 4);
         var3 += 4;

         for(var4 = 0; var4 < this.b.length; ++var4) {
            zcbz var7 = this.b[var4];
            System.arraycopy(com.aspose.cells.b.a.zc.a(var7.a), 0, var1, var3, 4);
            var3 += 4;
            System.arraycopy(com.aspose.cells.b.a.zc.a(var7.b.length), 0, var1, var3, 4);
            var3 += 4;

            for(int var6 = 0; var6 < var7.b.length; ++var6) {
               zcch.a(var7.b[var6], var1, var3);
               var3 += 16;
            }
         }
      }

      if (this.c != null) {
         System.arraycopy(com.aspose.cells.b.a.zc.a(this.c.length), 0, var1, var3, 4);
         var3 += 4;

         for(var4 = 0; var4 < this.c.length; ++var4) {
            var1[var3] = 2;
            var3 += 4;
            byte[] var8 = this.c[var4];
            System.arraycopy(var8, 0, var1, var3, var8.length);
            var3 += var8.length;
         }
      }

      if (this.d != null) {
         var3 = zcch.a(var1, var3, this.d);
      }

      return var3;
   }
}
